import sys
from PyQt5.QtWidgets import QApplication, QWidget, QTableWidget, QTableWidgetItem

class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.init_UI()

    def init_UI(self):
        self.resize(300, 200)
        tableWidget = QTableWidget(self)
        tableWidget.setRowCount(3)
        tableWidget.setColumnCount(2)

        newItem = QTableWidgetItem('新单元格')
        tableWidget.setItem(0, 0, newItem)

        self.show()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    ex= Example()
    sys.exit(app.exec_())